<html>
<head>
<title>Vocab app engine</title>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.2.3/dojo/dojo.xd.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>

{{ user_text }} <a href="/html/">Home</a> | <a href="{{ url }}">{{ url_linktext }}</a>


<h1>Vocab</h1>
{% if editable %}
<script type="text/javascript">

        var onDojoLoad = function() {
                var data ={{ vocab.diagram }};
                var t = dojo.byId("diagram");
                t.value = dojo.toJson(data, true);
        }
        dojo.addOnLoad(onDojoLoad);

</script>
<form action="/html/update" method="post">

	<textarea id="diagram" name="diagram" rows="20" cols="80"></textarea><br />
	<br /><br />
	
	<table border="1">
	<tr>
		<th>name</th>
		<td><input type="text" name="name" value="{{ vocab.name }}"/></td>
	</tr>
{% if authenticated %}
	<tr>
		<th>archived</th>
		<td><input type="checkbox" name="archived" value="True" {% if vocab.archived %}checked{% endif %} /></td>
	</tr>
{% if vocab.published and vocab.author %}
	<tr>
		<th>locked</th>
		<td><input type="checkbox" name="locked" value="True" {% if vocab.locked %}checked{% endif %} /></td>
	</tr>
{% endif %}
	<tr>
		<th>published</th>
		<td>{% if vocab.published %}True{% else %}<input type="checkbox" name="published" value="True" />{% endif %}</td>
	</tr>
{% endif %}
	<tr>
		<th>key</th>
		<td>{{ vocab.key }}<input type="hidden" name="key" value="{{ vocab.key }}" /></td>
	</tr>
	<tr>
		<th>author</th>
		<td>{{ vocab.author }}</td>
	</tr>
	<tr>
		<th>date</th>
		<td>{{ vocab.date }}</td>
	</tr>
	<tr>
		<th>updated</th>
		<td>{{ vocab.updated }}</td>
	</tr>
	</table>
	
	<br /><br />
	
	<input type="submit" value="Save" />
<br />
</form>
{% else %}
<script type="text/javascript">

        var onDojoLoad = function() {
                var data ={{ vocab.diagram }};
                var t = dojo.byId("diagram");
                t.innerHTML = dojo.toJson(data, true);
        }
        dojo.addOnLoad(onDojoLoad);

</script>
<pre id="diagram" style="height:300px; width:600px; overflow:auto; background-color: #ddd;"></pre><br />
<br /><br />

<table border="1">
<tr>
    <th>name</th>
    <td>{{ vocab.name }}</td>
</tr>
<tr>
    <th>locked</th>
    <td>{% if vocab.locked %}True{% else %}False{% endif %}</td>
</tr>
<tr>
    <th>archived</th>
    <td>{% if vocab.archived %}True{% else %}False{% endif %}</td>
</tr>
<tr>
    <th>published</th>
    <td>{% if vocab.published %}True{% else %}False{% endif %}</td>
</tr>
<tr>
    <th>key</th>
    <td>{{ vocab.key }}</td>
</tr>
<tr>
    <th>author</th>
    <td>{{ vocab.author }}</td>
</tr>
<tr>
    <th>date</th>
    <td>{{ vocab.date }}</td>
</tr>
<tr>
    <th>updated</th>
    <td>{{ vocab.updated }}</td>
</tr>
</table>
<br /><br />
<br />
{% endif %}



<h1>History</h1>
{% for history in histories %}
<li>
	[<a href="/html/viewHistory/{{ history.key }}">{{ history.updated }}</a>] by
	{% if history.author %}
		<b>{{ history.author.nickname }}</b>
	{% else %}
		<b>Anonymous</b>
	{% endif %}
</li>	
{% endfor %}


</body>
</html>
